﻿<Window x:Class="WetHatLab.OneNote.TaggingKit.find.FindTaggedPages"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:prop="clr-namespace:WetHatLab.OneNote.TaggingKit.Properties"
        xmlns:local="clr-namespace:WetHatLab.OneNote.TaggingKit.find"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:find="clr-namespace:WetHatLab.OneNote.TaggingKit.find"
        mc:Ignorable="d"
        WindowStyle="ToolWindow"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type local:FindTaggedPagesDesignerModel}}"
        Title="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Window_Title}}"
        Left="{Binding Source={x:Static prop:Settings.Default},Path=TagSearchWindow_Left,Mode=TwoWay}"
        Top="{Binding Source={x:Static prop:Settings.Default},Path=TagSearchWindow_Top,Mode=TwoWay}"
        Height="{Binding Source={x:Static prop:Settings.Default},Path=TagSearchWindow_Height,Mode=TwoWay}"
        Width="{Binding Source={x:Static prop:Settings.Default},Path=TagSearchWindow_Width,Mode=TwoWay}"
        MinWidth="300"
        MinHeight="250"
        Closing="Window_Closing" Icon="/OneNoteTaggingKit;component/Resources/tagSearch 32x32.png" Loaded="Window_Loaded">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/OneNoteTaggingKit;component/Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
            <GradientStop Color="Ivory" Offset="0.497"/>
            <GradientStop Color="#FFE1ECF7" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" MinHeight="100"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="2*" MinHeight="100"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <ComboBox Name="searchComboBox"
                  Grid.Row="0" Grid.Column="0"
                  Margin="5,5,5,0"
                  IsEditable="true" IsTextSearchEnabled="True"
                  ItemsSource="{Binding SearchHistory}"
                  KeyUp="SearchComboBox_KeyUp"
                  ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Query_ComboBox_Tooltip}}" />
        <Button Name="searchButton" 
                Grid.Row="0" Grid.Column="1"
                Height="24"
                Style="{StaticResource controlEffectStyle}"
                Margin="0,5,0,0"
                Click="SearchButton_Click">
            <Image MaxWidth="32"  Source="/OneNoteTaggingKit;component/Resources/search-32x32 blue.jpg" />
        </Button>
        <ComboBox Grid.Row="0" Grid.Column="2"
                  Style="{StaticResource controlEffectStyle}"
                  IsEditable="False" IsTextSearchEnabled="True"
                  ItemsSource="{Binding Scopes}"
                  SelectedValue="{Binding SelectedScope,Mode=TwoWay}"
                  TextOptions.TextFormattingMode="Display"
                  DisplayMemberPath="ScopeLabel"
                  Margin="5,5,5,0"
                  SelectionChanged="ScopeComboBox_SelectionChanged"
                  ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Scope_ComboBox_Tooltip}}" >
        </ComboBox>
        <GroupBox Grid.Row="1" Grid.ColumnSpan="3"
                  HorizontalAlignment="Stretch"
                  Margin="5,0,5,0"
                  Background="Transparent"
                  ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Tags_GroupBox_Tooltip}}">
            <GroupBox.Header>
                <TextBlock>
                  <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Tags_GroupBox_Title}}"/>
                  <Run Text=" ("/>
                  <Run Text="{Binding TagCount, Mode=OneWay}"/>
                  <Run Text=")"/>
                </TextBlock>
            </GroupBox.Header>
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <WrapPanel Name="tagsPanel" />
            </ScrollViewer>
        </GroupBox>
        <ProgressBar Name="pBar"
                     Grid.Row="1"
                     Grid.ColumnSpan="3"/>
        <Button Name="clearSelectionButton"  Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Top"  HorizontalAlignment="Right" Click="ClearSelectionButton_Click" BorderThickness="0" BorderBrush="LightBlue" ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_ClearSelection_Button_Tooltip}}" Background="Transparent" Margin="0,0,25,0">
            <Image  MaxWidth="32" Height="24" HorizontalAlignment="Center" VerticalAlignment="Bottom" Source="/OneNoteTaggingKit;component/Resources/clear selection.png"/>
        </Button>
        
        <GridSplitter Grid.Row="2" Grid.ColumnSpan="3" ResizeDirection="Rows" Height="5" HorizontalAlignment="Stretch">
            <GridSplitter.Background>
                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="1"/>
                    <GradientStop Color="#FFE2EDF7" Offset="0.67"/>
                </LinearGradientBrush>
            </GridSplitter.Background>
        </GridSplitter>
        
        <GroupBox Grid.Row="3" Grid.ColumnSpan="3" 
                  HorizontalAlignment="Stretch" 
                  Margin="5,0,5,0" Background="Transparent"
                  ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Pages_GroupBox_Tooltip}}">
            <GroupBox.Header>
                <TextBlock>
                  <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagSearch_Pages_GroupBox_Title}}"/>
                  <Run Text=" ("/>
                  <Run Text="{Binding PageCount, Mode=OneWay}"/>
                  <Run Text=")"/>
                </TextBlock>
            </GroupBox.Header>
            <ListBox Background="Transparent" ItemsSource="{Binding Pages, Mode=OneWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <local:HitHighlightedPageLink Click="Hyperlink_Click" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </GroupBox>
    </Grid>
</Window>
